package m.jclecai.com.ui;

import android.app.Service;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.CountDownTimer;
import android.os.Handler;
import android.os.Vibrator;
import android.support.v4.view.ViewPager;
import android.text.Html;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.ScaleAnimation;
import android.widget.AbsListView;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.squareup.okhttp.Request;
import com.viewpagerindicator.CirclePageIndicator;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import butterknife.BindView;
import butterknife.OnClick;
import m.jclecai.com.R;
import m.jclecai.com.activity.LottoTrendActivity;
import m.jclecai.com.activity.WebHelperActivity;
import m.jclecai.com.adapter.KSPagerAdapters.BetSumValueAdapter;
import m.jclecai.com.adapter.KSPagerAdapters.BetThreeDifferentAdapter;
import m.jclecai.com.adapter.KSPagerAdapters.BetThreeSameAdapter;
import m.jclecai.com.adapter.KSPagerAdapters.BetTwoDifferentAdapter;
import m.jclecai.com.adapter.KSPagerAdapters.BetTwoSameAdapter;
import m.jclecai.com.adapter.KSPagerAdapters.BettingKSPagerAdapter;
import m.jclecai.com.adapter.SelectBoxKSAdapter;
import m.jclecai.com.adapter.independentLotteryAdapter.KSLotteryAdapter;
import m.jclecai.com.base.BaseActivity;
import m.jclecai.com.bean.KSIssueInfoBean;
import m.jclecai.com.bean.MissDataBean;
import m.jclecai.com.constant.Constant_Result;
import m.jclecai.com.constant.Constant_Url;
import m.jclecai.com.contents.LotteryType;
import m.jclecai.com.inter.IAdapterItemSelect;
import m.jclecai.com.inter.OnItemClick;
import m.jclecai.com.utils.BaseUtils;
import m.jclecai.com.utils.BonusUtils;
import m.jclecai.com.utils.MakeRandomUtil;
import m.jclecai.com.utils.PreferenceUtil;
import m.jclecai.com.utils.ToastUtil;
import m.jclecai.com.utils.http.FastOk;
import m.jclecai.com.utils.http.HttpManager;
import m.jclecai.com.view.common.BottomBar;
import m.jclecai.com.view.common.VeticalDrawerLayout;
import q.rorbin.badgeview.Badge;

/**
 * Created by hp on 2017/4/26.
 * <p>
 * 快三
 */

public class BetKSActivity extends BaseActivity {

    private PopupWindow selectBoxPop;
    GridView gv_selectBox;
    private PopupWindow pop;
    @BindView(R.id.tv_hint)
    TextView tv_hint;
    @BindView(R.id.tv_mode)
    TextView tv_mode;
    @BindView(R.id.tv_lottery_result)
    TextView tv_lottery_result;
    @BindView(R.id.iv_lottery_result_one)
    ImageView iv_lottery_result_one;
    @BindView(R.id.iv_lottery_result_two)
    ImageView iv_lottery_result_two;
    @BindView(R.id.iv_lottery_result_three)
    ImageView iv_lottery_result_three;
    int[] images = new int[]{R.drawable.dice_one, R.drawable.dice_two, R.drawable.dice_three, R.drawable.dice_four, R.drawable.dice_five, R.drawable.dice_six};
    @BindView(R.id.tv_finish_time)
    TextView tv_finish_time;
    @BindView(R.id.tv_time)
    TextView tv_time;
    private KSIssueInfoBean bean;
    private CountDownTimer timer;
    private String[] sumValue;
    private String[] twoDifferent;
    private String[] threeSame;
    private String[] twoSame;
    private String[] sumBonus;
    private String[] threeDifferent;
    private ViewPager vp_betting_ks;
    private BettingKSPagerAdapter vp_adapter;

    private SelectBoxKSAdapter adapter;
    @BindView(R.id.iv_add_selector)
    ImageView iv_add_selector;


    private int currentPosition;//当前页面
    private BetSumValueAdapter adapter1;
    private BetThreeSameAdapter adapter2;
    private BetTwoSameAdapter adapter3;

    private BetThreeDifferentAdapter adapter4;
    private BetTwoDifferentAdapter adapter5;
    @BindView(R.id.tv_count)
    TextView tv_count;
    int randomResule = 0;

    String TAG = "ks";


    //TODO 页面内开奖结果http://blog.csdn.net/wingichoy/article/details/50583022

    //玩法
    private ArrayList<String> mode = new ArrayList<>();
    //注数金额
    private ArrayList<String> numMoney = new ArrayList<>();
    //最终数据
    private ArrayList<String> ballNumber = new ArrayList<>();
    //总金额
    private int totalMoney;
    //总注数
    private int totalNum;

    //默认
    List<String> defaultBetParamete = new LinkedList<>();

    //多选
    List<String> multiselectParamete = new LinkedList<>();

    @BindView(R.id.tv_sum_number)
    TextView tv_sum_number;
    @BindView(R.id.tv_bonus)
    TextView tv_bonus;
    private AnimationDrawable animationDrawableOne;
    private AnimationDrawable animationDrawableTwo;
    private AnimationDrawable animationDrawableThree;
    private AnimationDrawable animationDrawable;
    @BindView(R.id.rl_random_list)
    RelativeLayout rl_random_list;
    @BindView(R.id.iv_shazi_one)
    ImageView iv_shazi_one;
    private AnimationSet set;
    private Handler handler;
    @BindView(R.id.iv_shazi_two)
    ImageView iv_shazi_two;
    @BindView(R.id.iv_shazi_three)
    ImageView iv_shazi_three;
    private SensorManager manager;
    private Vibrator vibrator;

    @BindView(R.id.lv_history)
    ListView lv_history;

    @BindView(R.id.iv_close)
    ImageView iv_close;
    private String type;
    private KSLotteryAdapter lotteryAdapter;
    // private LinearLayout historyView;
    private CirclePageIndicator mPageIndicator;
    private VeticalDrawerLayout mPullLayout;

    private boolean isOpen = false;
    private View mLlPeroidSuccess;
    private View mFlPeroidLoading;
    private View mLlBottomTitle;
    private BottomBar mBottomBar;

    @BindView(R.id.tv_betting_number)
    TextView mTvBettingNumber;

    @BindView(R.id.tv_profit)
    TextView mTvProfit;

    //=====新增字段======
    private TextView mTvMissData;
    private String mSubTitle;

    @Override
    protected int getContentView() {
        return R.layout.betting_ks_activity;
    }

    @Override
    protected void onPause() {
        super.onPause();
    }


}